Repository navigation
Add a prototype namespace squatting dashboard view - #2447
autumnfound wants to merge 7 commits into
Conversation
Adds pg_trgm, a pair allowlist table and trigram indexes on extension and display names, with a repository that probes one extension's names against active extensions and finds display names shared across namespaces. Groundwork for the name squatting admin dashboard. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
|
@gnugomez once you finish with the first PR in the stack, I can look at getting this updated based on your change sets to be more compliant with the updates! I kept this separate in case we want to refine this more separately from the base dashboard along with use cases. |
Adds the non-enforced NAME_SIMILARITY publish check, which flags versions whose name or display name resembles another namespace's active extension, and admin endpoints that re-probe flagged extensions and shared display names live and manage the pair allowlist. Lookups run under a transaction-local statement timeout so a slow probe cannot tie up the database. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds a Name Squatting admin page with a Collisions tab, listing look-alike extensions against the one published first with actions to allow the pair or delete the look-alike, and an Allowlist tab grouped by the allowed extension. Backed by new admin service methods for the name squatting endpoints. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds a lookup of namespace pairs whose names are within an edit distance that grows with their length, or differ only in separators, with each side's active extension downloads and whether they share a member. A trigram index on namespace names prefilters the pairs. name_similarity_allow now also holds allowed namespace pairs, marked by the NAMESPACE field, so both kinds share one table. Groundwork for a namespaces view of the name squatting admin dashboard. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
List pairs of namespaces whose names resemble each other, with the namespace with more downloads as target, filtered to popular targets by default so admins can switch to the full list to catch quiet, niche squatting. Admins can allow a pair or remove the allow. The lookup reads every namespace, so its pairs are reused for a minute per instance; allows are read on every request and apply at once. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Lists namespace pairs whose names differ by a typo or only in separators, the more downloaded namespace as target, with a popular-targets switch (on by default) and a sort by downloads or newest look-alike, both kept in the URL. Admins can allow a pair; the Allowlist tab gains a toggle to list and remove allowed namespace pairs. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
a35d3ed to
8bd45a1
Compare
- Select pairs with checkboxes and allow them from one bar - Allow a single row or a whole group from a round check button - Group the pairs in the allow dialog under what they resemble - Use the round bin for deletes, as on tokens and trusted publishers - Checkbox filters, secondary toggle groups and search first, as on Extension Scans - Link the display name to the public page and the identifier to the admin page - Refresh collisions and namespace pairs every minute, showing when they were updated - Drop the ellipsis from button labels Signed-off-by: Jordi Gómez <jordi.gomez@eclipse-foundation.org>
|
@autumnfound I just pushed the changes I wanted to make, in regards to the UI at some point I would like to refactor a bit the admin dashboard since every time we add a new view we re-invent the wheel, the scans view looks completely different from others despite having similar features. |
|
@gnugomez thanks! It looks like you've updated both PRs which I appreciate. I'll load it up today and take a peek and let you know if I have any feedback.
+1 from me! I think that makes a lot of sense rather than creating bespoke elements every time. |
There was a problem hiding this comment.
🟡 Changes recommended
Allowlist pagination skips entries at page boundaries, similarity filtering misses valid matches, and UI handling can duplicate pairs or show empty results after failed requests.
5 open issues
4 files not reviewed
server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Indexes.java: Generated fileserver/src/main/jooq-gen/org/eclipse/openvsx/jooq/Keys.java: Generated fileserver/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/NameSimilarityAllow.java: Generated fileserver/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/records/NameSimilarityAllowRecord.java: Generated file
What changed in this PR
Extends the existing name-squatting admin dashboard with namespace similarity review and namespace-pair allowances.
Changes:
- Adds namespace similarity lookup, cached results, popularity filtering, sorting, and admin endpoints.
- Adds a Namespaces tab and namespace allowlist, plus shared selection and refresh controls.
- Updates database mappings, configuration documentation, changelogs, and server/UI tests.
| File | Description |
|---|---|
| webui/test/unit/pages/admin-dashboard/name-squatting/namespaces-tab.spec.tsx | Tests namespace filtering, sorting, pagination, and allowances. |
| webui/test/unit/pages/admin-dashboard/name-squatting/name-squatting.spec.tsx | Tests namespace-tab navigation. |
| webui/test/unit/pages/admin-dashboard/name-squatting/name-squatting-model.spec.ts | Tests namespace-page merging. |
| webui/test/unit/pages/admin-dashboard/name-squatting/collisions-tab.spec.tsx | Tests refresh and selection behavior. |
| webui/test/unit/pages/admin-dashboard/name-squatting/allowlist-tab.spec.tsx | Tests namespace allowance listing and removal. |
| webui/test/unit/admin-name-squatting-request.spec.ts | Tests namespace API requests. |
| webui/src/pages/admin-dashboard/name-squatting/use-name-squatting.ts | Adds namespace query hooks, mutations, and polling. |
| webui/src/pages/admin-dashboard/name-squatting/namespaces-tab.tsx | Implements namespace-pair review controls and results. |
| webui/src/pages/admin-dashboard/name-squatting/namespace-allowlist.tsx | Displays and removes namespace allowances. |
| webui/src/pages/admin-dashboard/name-squatting/name-squatting.tsx | Adds the Namespaces tab and descriptions. |
| webui/src/pages/admin-dashboard/name-squatting/name-squatting-styles.ts | Adds shared toggle styling. |
| webui/src/pages/admin-dashboard/name-squatting/name-squatting-parts.tsx | Adds namespace links, grouped pairs, and shared errors. |
| webui/src/pages/admin-dashboard/name-squatting/name-squatting-controls.tsx | Adds shared search, selection, and refresh controls. |
| webui/src/pages/admin-dashboard/name-squatting/collisions-tab.tsx | Adds filtered bulk selection and shared controls. |
| webui/src/pages/admin-dashboard/name-squatting/collision-group.tsx | Adds group and row selection actions. |
| webui/src/pages/admin-dashboard/name-squatting/allowlist-tab.tsx | Switches between extension and namespace allowances. |
| webui/src/pages/admin-dashboard/name-squatting/allow-namespaces-dialog.tsx | Confirms namespace allowances with optional reasons. |
| webui/src/pages/admin-dashboard/name-squatting/allow-dialog.tsx | Supports selected extension pairs across groups. |
| webui/src/extension-registry-types.ts | Defines namespace dashboard request and response types. |
| webui/src/extension-registry-service.ts | Adds namespace dashboard API methods. |
| webui/CHANGELOG.md | Documents namespace review and bulk selection. |
| server/src/test/java/org/eclipse/openvsx/scanning/NameSimilarityCheckServiceTest.java | Adapts fixtures to nullable extension IDs. |
| server/src/test/java/org/eclipse/openvsx/scanning/NameSimilarityCheckConfigTest.java | Tests popularity settings and validation. |
| server/src/test/java/org/eclipse/openvsx/repositories/NamespaceSimilarityJooqRepositoryTest.java | Tests namespace matching, statistics, and query behavior. |
| server/src/test/java/org/eclipse/openvsx/repositories/NameSimilarityAllowRepositoryTest.java | Tests namespace allowance persistence and constraints. |
| server/src/test/java/org/eclipse/openvsx/repositories/JooqOnlyTestConfig.java | Registers the namespace similarity repository. |
| server/src/test/java/org/eclipse/openvsx/admin/NameSquattingServiceTest.java | Tests namespace ordering, filtering, pagination, and allowances. |
| server/src/main/resources/db/migration/V1_88__Namespace_Similarity.sql | Adds namespace allowances and similarity indexes. |
| server/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/records/NameSimilarityAllowRecord.java | Updates generated allowance record fields. |
| server/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/NameSimilarityAllow.java | Updates generated table mappings and constraints. |
| server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Keys.java | Adds generated namespace foreign keys. |
| server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Indexes.java | Adds generated namespace allowance indexes. |
| server/src/main/java/org/eclipse/openvsx/scanning/NameSimilarityCheckConfig.java | Defines and validates popularity thresholds. |
| server/src/main/java/org/eclipse/openvsx/repositories/NamespaceSimilarityJooqRepository.java | Implements namespace similarity lookup and comparison. |
| server/src/main/java/org/eclipse/openvsx/repositories/NameSimilarityJooqRepository.java | Shares timeout and trigram helpers. |
| server/src/main/java/org/eclipse/openvsx/repositories/NameSimilarityAllowRepository.java | Adds namespace allowance queries. |
| server/src/main/java/org/eclipse/openvsx/json/NameSquattingJson.java | Adds namespace API payloads. |
| server/src/main/java/org/eclipse/openvsx/entities/NameSimilarityAllow.java | Supports extension and namespace allowance records. |
| server/src/main/java/org/eclipse/openvsx/admin/NameSquattingService.java | Adds cached namespace review and allowance management. |
| server/src/main/java/org/eclipse/openvsx/admin/NameSquattingAPI.java | Exposes namespace review and allowance endpoints. |
| server/src/dev/resources/application.yml | Adds development popularity settings. |
| server/CHANGELOG.md | Documents namespace endpoints and migration requirements. |
| doc/configuration.md | Documents namespace popularity controls. |
Review effort: Balanced
| // One more than asked tells whether there is a next page. | ||
| var found = allows.findByFieldOrderByDecidedAtDescIdDesc( | ||
| NameSimilarityField.NAMESPACE, | ||
| PageRequest.of(page, size + 1)); |
| * Trigram similarity a pair needs before its edit distance is computed, low enough to lose no pair | ||
| * within the allowed edits: it only spares the edit distance of every pair of namespaces. | ||
| */ | ||
| static final float PREFILTER_THRESHOLD = 0.3f; |
| </Box> | ||
| ); | ||
| } | ||
| if (visible.length === 0) { |
| </Box> | ||
| ); | ||
| } | ||
| if (!data || data.pairs.length === 0) { |
| export const namespacePairKey = (pair: NameSquattingNamespacePair): string => | ||
| `${pair.target.name}/${pair.lookalike.name}`; |
netomi
left a comment
There was a problem hiding this comment.
Thanks, the namespaces view is a useful addition. Since this builds on #2437, the rebase and the points raised there carry over; besides the inline comments:
Paging and selection (Namespaces tab)
- Pages are fetched by offset from a list that changes between requests (the 1-minute server cache, and allows applying at once), so a shrinking list silently skips pairs;
mergeNamespacePairPagesonly handles duplicates. namespacePairKeyis built from target/look-alike, but which side is the target depends on live download counts, so a pair whose counts swap appears as botha/bandb/aand loses its selection after a refetch. An order-independent key (sorted names) avoids that.- The namespace allowlist search only filters loaded pages and shows "No allowed namespaces match this filter" while more pages remain.
Minor
useAllowNameSquattingNamespacesinvalidatesnameSquattingKeys.all, refetching every loaded collisions page with live probes although a namespace allow cannot change them; the namespaces prefix is enough.- The Javadoc of
NameSimilarityField(and ofNAMESPACE, "only ever reported alongside another field") no longer holds now thatNAMESPACEmarks namespace-pair allows. forgetNamespacePairs()exists only for tests; an injectable cache or clock would avoid the extra method in the service.
| * Trigram similarity a pair needs before its edit distance is computed, low enough to lose no pair | ||
| * within the allowed edits: it only spares the edit distance of every pair of namespaces. | ||
| */ | ||
| static final float PREFILTER_THRESHOLD = 0.3f; |
There was a problem hiding this comment.
0.3 does lose pairs within the allowed edits: abcdefghi and abxdefxhi are 2 substitutions apart (allowed at 9 characters), but share only 4 of 16 pg_trgm trigrams, a similarity of 0.25. Two spread-out edits in a 9-10 character name break up to 6 trigrams, so such pairs are never found, and since compare() uses the same cutoff they cannot be allowed either. Either lower the threshold for the lengths that allow 2 edits (and measure the cost), or correct the Javadoc to state what is traded away.
| select: mergeCollisionPages, | ||
| retry: false | ||
| retry: false, | ||
| refetchInterval: REFRESH_INTERVAL_MS |
There was a problem hiding this comment.
Polling the collisions query refetches every loaded page of the infinite query, each running live trigram lookups for its candidates, every minute per open tab. That is a steady load on the database for an admin page left open; I would drop the interval here (a manual refresh is enough), or at least not poll infinite queries. It is also not mentioned in the changelog.
| try { | ||
| pairs = namespacePairs.get( | ||
| Boolean.TRUE, | ||
| key -> namespaceSimilarity.findSimilarPairs(check.getStatementTimeout())); |
There was a problem hiding this comment.
The full pair lookup reuses the per-publish statement timeout (10 s by default), and a timed-out lookup is not cached, so on a large registry every 60 s refetch from each open Namespaces tab, and every "Try again", starts another full scan that fails with 503. This needs its own (larger) timeout, and the failure should be remembered for a while instead of retried on every request.
| allow.setReason(reason); | ||
| allow.setDecidedById(admin.getId()); | ||
| allow.setDecidedAt(TimeUtil.getCurrentUTC()); | ||
| allows.save(allow); |
There was a problem hiding this comment.
Same check-then-insert race as in allow() (see #2437): two concurrent allows of the same pair both pass the check, and the second violates name_similarity_allow_namespace_pair_idx with a 500 instead of "Already allowed".



This request builds on top of the existing name squatting dashboard to add a third tab for namespaces and add support for allows alongside the existing extension allowances for name squatting. Below are a more thorough description of the various commits for more easy comparison.
Adds a lookup of namespace pairs whose names are within an edit distance
that grows with their length, or differ only in separators, with each
side's active extension downloads and whether they share a member. A
trigram index on namespace names prefilters the pairs. name_similarity_allow
now also holds allowed namespace pairs, marked by the NAMESPACE field, so
both kinds share one table. Groundwork for a namespaces view of the name
squatting admin dashboard.
List pairs of namespaces whose names resemble each other, with the namespace
with more downloads as target, filtered to popular targets by default so
admins can switch to the full list to catch quiet, niche squatting. Admins
can allow a pair or remove the allow. The lookup reads every namespace, so
its pairs are reused for a minute per instance; allows are read on every
request and apply at once.
Lists namespace pairs whose names differ by a typo or only in separators,
the more downloaded namespace as target, with a popular-targets switch (on
by default) and a sort by downloads or newest look-alike, both kept in the
URL. Admins can allow a pair; the Allowlist tab gains a toggle to list and
remove allowed namespace pairs.
changeset descriptions pulled from Claude commit comments, beep boop